import request from '@/utils/request.js'
import { useTokenStore } from '@/stores/token.js'
//考试分类列表查询
export const examCategoryListService = ()=>{
    //const tokenStore = useTokenStore();
    //在pinia中定义的响应式数据,都不需要.value
    //return request.get('/category',{headers:{'Authorization':tokenStore.token}})
    return request.get('/category')
}

//考试分类添加
export const examCategoryAddService = (categoryData)=>{
    return request.post('/category',categoryData)
}

//考试分类修改
export const examCategoryUpdateService = (categoryData)=>{
   return  request.put('/category',categoryData)
}

//考试分类删除
export const examCategoryDeleteService = (id)=>{
    return request.delete('/category?id='+id)
}

//考试列表查询
export const examListService = (params)=>{
   return  request.get('/exam',{params:params})
}

//考试添加
export const examAddService = (examData)=>{
    return request.post('/exam',examData);

}

// 删除考试
export const examDeleteService = (id) => {
    return request.delete(`/exam?id=${id}`);
};

// 下载考试归档
export const examDownloadZipService = (id) => {
    return request.get(`/exam/download/${id}`, { responseType: 'blob' });
};

// 更新考试信息
export const examUpdateService = (examData) => {
    return request.put('/exam', examData);
};

// 考试状态查询
export const examStatusService = (id) => {
    return request.get(`/exam/status/${id}`);
};